package com.example.springcloudwinter.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {
    public static SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    public static String getTodayString(){
        return dateFormat.format(new Date());
    }

    public static Date getTodayDate(){
        return new Date();
    }

    public static Date getDateByString(String date){
        try {
            return dateFormat.parse(date);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return null;
    }
}
